<template>
  <div class="block" v-show="this.objLst.total !== 0">
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :page-sizes="[10, 20, 30, 40]"
      :current-page="objLst.pageNum"
      :page-size="objLst.pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="objLst.total"
    >
    </el-pagination>
  </div>
</template>
<script>
export default {
  props: { queryList: { type: Object } },
  data() {
    return {
      objLst: {},
    };
  },
  // 监听父组件发生改变更新子组件数据
  watch: {
    queryList: {
      handler(n, o) {
        this.objLst = n;
        console.log(o);
      },
      immediate: true,
    },
  },
  mounted() {
    this.objLst = this.queryList;
  },
  methods: {
    handleSizeChange(val) {
      this.$parent.handleSizeChange(val);
    },
    handleCurrentChange(val) {
      this.$parent.handleCurrentChange(val);
    },
  },
};
</script>
<style scoped lang="less">
.block {
  margin-top: 15px;
  background: white;
}
</style>
